function addsite() {
    var msg = "您真的确定要添加车次吗？\n\n请确认！";
    if (confirm(msg) == true) {
        var site1 = $("#shuju").val();//站点
        var site2 = site1.split(",");
        var site = "";
        for (let i = 0; i < site2.length; i++) {
            let site3 = site2[i].split("-");//本次单元站点
            site += site3[0] + ",";
            if (i == site2.length - 1) {
                site += site3[1];
            } else {
                let site4 = site2[i + 1].split("-");//下一个单元站点
                if (site3[1] != site4[0]) {
                    alert("区间站点" + site3[1] + "-" + site4[0] + "不存在,请重新添加!");
                    return;
                }
            }
        }
        var trainname = $("#trainname").val();//列车名
        var traintype = $("#traintype").bind("option:selected").val();//列车类型
        var hour = $("#hour").bind("option:selected").val();
        var second = $("#second").bind("option:selected").val();
        var date = hour + ":" + second;//出发时间
        var row = $("#rownum").val();//车厢排数
        var col = $("#colnum").val();//车厢列数
        if(col>5){
            alert("车厢列数不能大于5");
            return;
        }
        if(row>20){
            alert("车厢排数不能大于5");
            return;
        }
        var price = $("#price").val();//里程价格

        var obj = new Object();
        var carriagenum = $("#carriagenum").val();//车厢个数

        obj.trainname = trainname;
        obj.traintype = traintype;
        obj.date = date;
        obj.carriagenum = carriagenum;
        obj.row = row;
        obj.col = col;
        obj.price = price;
        obj.site = site;
        obj.carriagenum = carriagenum;
        $.ajax({
            type: "post",
            url: "route/addroute",
            contentType: "application/json;charset=UTF-8",
            data: JSON.stringify(obj),
            success: function (data) {
                if (data = "1") {
                    alert("添加路线成功！");
                } else {
                    alert("添加路线失败！");
                }
            },
            error: function (data) {
                alert("添加路线失败！");
            }
        });
    }


}